<?php
class BoolDataHandle extends AbsDataHandle {
	private static $options = array(
		'value' => null,
	);
	
	public static function getType() {
		return 'bool';
	}
	
	public static function handle($defineCfg) {
		$options = (isset($defineCfg['options']) && is_array($defineCfg['options'])) ? $defineCfg['options'] : array();
		
		$options = array_merge(self::$options, $options);
		
		return self::genData($options);
	}
	
	private static function genData($options) {
		if(null !== $options['value']) $data = $options['value'];
		else {
			$data = (bool)mt_rand(0, 1);
		}
		
		return $data;
	}
}
?>